package com.pxx.search.controller;

import com.item.common.PageResult;
import com.pxx.search.pojo.GoodsEs;
import com.pxx.search.pojo.SearchRequest;
import com.pxx.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SearchController {

    @Autowired
    SearchService searchService;

    @RequestMapping("/page")
    public ResponseEntity<PageResult<GoodsEs>> page(@RequestBody SearchRequest search){
       PageResult<GoodsEs> list=  searchService.pagesearch(search);
       if(list==null){
           return new ResponseEntity<>(HttpStatus.FOUND);
       }
       return ResponseEntity.ok(list);
    }


}
